package ar.edu.itba.pod.Legajo47342.communication.handlers;

import ar.edu.itba.pod.Legajo47342.Node;
import ar.edu.itba.pod.Legajo47342.market.MarketImpl;
import ar.edu.itba.pod.simul.communication.Message;
import ar.edu.itba.pod.simul.communication.payload.NodeMarketDataPayload;

public class NodeMarketDataHandler implements Handler {

	private Node node;

	public NodeMarketDataHandler(Node node) {
		super();
		this.node = node;
	}
	
	@Override
	public void handle(Message m) {
		NodeMarketDataPayload pay = (NodeMarketDataPayload) m.getPayload();
		
		((MarketImpl)node.getMarketManager().market()).addData(pay.getMarketData().getHistory().getTransactionsPerSecond());

	}

}
